package cn.iocoder.yudao.module.alipay.dal.mysql.infoslideshow;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.alipay.dal.dataobject.infoslideshow.InfoSlideshowDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.alipay.controller.admin.infoslideshow.vo.*;

/**
 * 轮播图 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface InfoSlideshowMapper extends BaseMapperX<InfoSlideshowDO> {

    default PageResult<InfoSlideshowDO> selectPage(InfoSlideshowPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<InfoSlideshowDO>()
                .eqIfPresent(InfoSlideshowDO::getImageUrl, reqVO.getImageUrl())
                .eqIfPresent(InfoSlideshowDO::getSort, reqVO.getSort())
                .eqIfPresent(InfoSlideshowDO::getTypeId, reqVO.getTypeId())
                .betweenIfPresent(InfoSlideshowDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(InfoSlideshowDO::getId));
    }

    default List<InfoSlideshowDO> selectList(InfoSlideshowExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<InfoSlideshowDO>()
                .eqIfPresent(InfoSlideshowDO::getImageUrl, reqVO.getImageUrl())
                .eqIfPresent(InfoSlideshowDO::getSort, reqVO.getSort())
                .eqIfPresent(InfoSlideshowDO::getTypeId, reqVO.getTypeId())
                .betweenIfPresent(InfoSlideshowDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(InfoSlideshowDO::getId));
    }

   default   List<InfoSlideshowDO> selectListByTypeId(String typeId){
        return selectList(new LambdaQueryWrapperX<InfoSlideshowDO>()
                .eq(InfoSlideshowDO::getTypeId,typeId));
   };
}
